# -*- coding: utf8 -*-

import string

filename="C:\\files_hemus.txt"
outfile=filename+".sql"

print "Started..."

f=open(filename,"rt")
fw=open(outfile,"wt")

for line in f.readlines():
#	if  string.strip(line)=="":
#		continue
	val1=string.strip(line)
#	cols=string.split(line,'|')
	
#	prevcode=string.strip(cols[0])
#	quantity=string.replace(string.strip(cols[3])," бр","")
#	val1=string.strip(cols[1])
#	val2=string.strip(cols[4])
#	val3=val2
	txt="""insert into BANKSTATEMENTSIMPORT    
    (id, bankaccount, tobank, currency, fromdate, 
    todate, totalamountin, totalamountout, totalrecords, 
    importeddetails, imported,
    confirmed, sendedtransfer, receivedtransfer, 
    nactiv , cdate, ctime, cuser,ugrp, filename)
values 
    (s_BANKSTATEMENTSIMPORT.nextval, 0,0,0,to_date('01.01.1900','dd.mm.yyyy'),
    to_date('01.01.1900','dd.mm.yyyy'),0,0,0,
    0,0,
    0,0,0,
    0,sysdate,to_number(to_char(sysdate,'sssss')),1,10, '/home/appuser/import/bank/%s');\n"""%(val1)

	fw.write(txt)
	
f.close()
fw.close()

print "OK."


